﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>智能水电查询系统</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/sign.css">
    <script>(window.top === window.self) || (window.top.location.href = window.self.location.href);</script>
</head>

<body class="layui-unselect lau-sign-body">

    <div class="layui-form layui-form-pane lau-sign-form">

        <p class="lau-sign-subtitle">SDMS智能水电查询系统</p>

        <div class="layui-form-item layui-row layui-col-space16">
            <label class="layui-form-label"><i class="layui-icon layui-icon-username"></i> 楼    栋</label>
             <div class="layui-input-block">
                <select name="BuildingName" lay-verify="required">
                    <option value="">请选择楼栋</option>
                    @foreach (var item in ViewBag.Buildings)
                        {
                            <option value="@item">@item</option>
                        }
                    </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><i class="layui-icon layui-icon-username"></i> 房    间</label>
            <div class="layui-input-block">
                <input type="text" name="HomeNumbe" placeholder="请输入房间号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <button type="button" class="layui-btn layui-btn-fluid" lay-submit lay-filter="Submit">提 交</button>
        </div>

    </div>

    <script src="/static/layui/layui.js"></script>
    <script src="~/lib/jquery/dist/jquery.min.js"></script>

</body>

</html>

<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
        form = layui.form;
        //监听提交
        form.on('submit(Submit)', function (data) {
            // 提交数据
            $.ajax({
                url: '/User/BuidingLogin',
                type: 'POST',
                data: data.field,
                success: function (res) {
                    if (res.code == 200) {
                        layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                            window.location.href = res.data;
                        });
                    } else {
                        layer.msg(res.msg, { icon: 2, time: 1000 });
                    }
                },
                error: function (res) {
                    layer.msg('请求失败', { icon: 2, time: 1000 });
                }
            });
        });

    })
</script>